//: Playground - noun: a place where people can play

import UIKit

// 1. 用到时才加载
// 2. 多次使用只会加载一次

class Person {
    lazy var names : [String] = {
        let names = ["Alex"]
        print("初始化了一个数组")
        return names
    }()

    lazy var button : UIButton = {
        let button = UIButton()
        button.setTitle("Alex", for: .normal)
        print("初始化了一个button")
        return button
    }()
}

let p = Person()
let array = p.names
let array1 = p.names

let button = p.button
let button1 = p.button

